# -*- coding:UTF-8 -*-
from cmdb.models import BusinessServerMapping

def filter_server_mapping_no(equipment_no):
    bmInfo = BusinessServerMapping.objects.filter(equipment_no=equipment_no)
    return bmInfo

def server_mapping_no_count(equipment_no, cursor):
    mapping_sql = 'select count(*) from business_server_mapping where equipment_no="' + equipment_no + '"'
    cursor.execute(mapping_sql)
    mappingNumRes = cursor.fetchone()
    return mappingNumRes[0]